package com.runfig.springcloud.productfigserver.feign;

import com.runfig.springcloud.domain.Product;
import com.runfig.springcloud.fegin.ProductFeignApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
public class ProductFeignClient implements ProductFeignApi {


    @Value("${server.port}")

    private String port;

    @Override

    public Product get(Long id) {
        Product product = new Product();
        product.setId(id+10);
        product.setName(port);
        product.setPrice(new BigDecimal("99"));
        product.setStock(100);
//        try {
//            Thread.sleep(6000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        return product;
    }


}